State machines may often be used to describe and define the operation of communication systems. A communication device state machine is a logical model of the operations of the device. A state machine may comprise a finite number of states and may define the allowed state transitions. A state may be understood herein as a part of a series, e.g., a cycle, of actions a communication device operating according to the state machine goes through, and it may correspond to a particular number and/or order of actions. The actions of the series or cycle may be understood to refer to e.g., computing procedures, or physical procedures such as transmitting or receiving messages or signals from another communication devices operating according to the state machine. The communication device may only be in one of the states at a time. The device may change state from one state to another when some predetermined conditions are fulfilled or certain events triggered. Such a change of states is referred to as a state transition. A state machine may be defined by its states and the triggering conditions for state transitions. The actions that a device in the system may take depend on its current state and a device may typically only change state given that some pre-determined conditions are met, not all actions may be allowed in all states. The knowledge of the state of a device may provide its communicating peer with information regarding what may be expected of this device and such predictable device behaviour may be used to run and optimize the operation of the system.
Among the triggering conditions for state transitions may be messages transmitted between the communication peers. For example, for two devices in a first state of a configured series of states, a specific first message from a first one of the devices may trigger the peer, second, device to enter a second state. The second device may then send a second message to the first device, and trigger the first device to also enter the second state.
A communication error between the peers, e.g., one of the peers not receiving the specific message from the first device, may result in a state mismatch. A state mismatch may be understood herein as a situation wherein the two devices communicating, device 1 and device 2 are not associated with the same state. To be associated with the same state refers herein to have the same state, or to be in the expected path to transition to the state of the other device, according to the communication exchanged between the devices. In other words, a state mismatch occurs when the device 1 is in a state that is not consistent with the state of the device 2.
If a state mismatch happens, communication between the peers may be delayed. Moreover, peer devices may not be able to communicate properly according to the sequence of expected actions, and unnecessary transmissions may occur between the peers that are set to fail, resulting in wasted energy and resources, as well as causing interference in the network. Moreover, the devices may be unable to communicate with other devices during the time of the state mismatch. The state mismatch hence degrades the performance not only of the link between the devices involved in the state mismatch, but for the entire network.
Currently, existing methods to approach the state mismatch problem are based on the use of timeouts. For example, if an expected response from a peer device is not received within some pre-defined time, a time out will happen, and the mismatch may be resolved. However, the resolution of state mismatches based on a time out is slow and inefficient.
An example of a communication system state machine is the LTE UE Radio Resource Control (RRC state) machine, which comprises two states: idle and connected. A communication device, e.g., a UE, operating according to the LTE UE RRC state machine may move from idle to connected state once a connection is established and may move from connected to idle state when the connection is released. The LTE UE RRC state machine is defined in 3GPP TS 36.331 “Evolved Universal Terrestrial Radio Access (E-UTRA); Radio Resource Control (RRC); Protocol specification”, v12.5.0, (2015-03),
Another communication system state machine is the Bluetooth Low Energy (BLE) link layer state machine, depicted in the schematic diagram of FIG. 1. The BLE state machine may comprise five states, referred to as standby, advertising, scanning, initiating, and connection state. The directed arrows in FIG. 1 define the permitted state transitions.
BLE is a low-energy, low-cost radio communication technology that may be used, e.g., to collect information from sensors in an area. One possible setup is to have one Bluetooth low energy central device collecting information from several peripheral devices. In such a case, the central device acts as a master and is connected to several peripheral devices which, once in a connection with the central device, act as slaves. To support a large number of peripheral devices, it is in many cases advantageous if the master is able to maintain several simultaneous connections, each connection being associated with a different peripheral device. A device in initiating state is a central device, whereas a device in advertising state is a peripheral device. When a connection is created, the central device, in initiating state, may take the role as a master in the connection and the peripheral device, in advertising state may take the role as slave in the connection.
The Industrial, Scientific and Medical (ISM) radio bands are radio bands reserved internationally for the use of Radio Frequency (RF) energy for industrial, scientific and medical purposes. In recent years the fastest-growing uses of these bands have been for short-range, low power communications systems. Bluetooth devices may use frequencies allocated to ISM, although this low power emitter is not considered ISM.
BLE is defined to operate in the 2.4 GigaHertz (GHz) ISM band, and uses approximately 80 MegaHertz (MHz) of the spectrum. In BLE, there are 40 channels or frequencies of 1 MHz; the frequencies being separated by 2 MHz. Out of these 40 frequencies, three are advertising frequencies, link layer frequencies 37, 38, and 39, that may be used, e.g., to initiate a connection between a master node and a slave device, and 37 are data frequencies, link layer frequencies 0-36, which may be used for payload exchange between the master node and the slave device. FIG. 2 is a schematic diagram depicting the BLE frequency map, with the respective link layer frequency numbers. The first physical channel, which corresponds to the link layer frequency 37, resides at 2402 MHz, whereas the last physical channel, i.e., link layer frequency 39, resides at 2480 MHz. A BLE physical channel has a bandwidth of 1 MHz and may use GFSK modulation.
A communication device operating according to the BLE state machine is known as a BLE device. A BLE device in advertising state is known as an advertiser, a device in scanning state, which may also be referred to herein as searching state, is known as a scanner, and a device in initiating state is known as an initiator. In connection state, the device may be referred to as either master or slave, depending on if it enters connection state from the initiating state or the advertising state, respectively. In standby state, the device is idle and no packets may be transmitted or received.
In BLE, one common approach to set up a connection may be that an advertiser transmits a directed advertisement message (ADV_DIRECT_IND), i.e., an advertisement message destined to a specific peer device, and asks this device to set up a connection. Alternatively, an undirected advertisement message (ADV_IND) may be transmitted. In this case, any device may answer. If the peer device is in initiating state and is able to correctly receive the advertising message, it may respond with a connection request (CONNECT_REQ) message, which includes the connection setup parameters. The data transfer in between the two devices then may start by a packet transmission from the master to the slave. Transmission of the advertisement message may be in an advertisement channel, that is, in a frequency assigned for transmission of advertisement messages, as depicted in FIG. 2. Transmission of the data may be in a data channel, that is, in a frequency in the data channel, as depicted in FIG. 2.
An example of a successful BLE connection setup procedure is depicted in FIG. 3. The procedure depicted in FIG. 3 assumes that the advertiser transmits a directed advertisement message, however, the description is valid also if an undirected advertisement message is transmitted. It is assumed that there are two devices, referred to as device 1 and device 2. Device 2, the advertiser, is in advertising state with the ambition to setup a connection with device 1, the initiator, which is in initiating state. First, the advertiser transmits a direct advertisement message at time to. The initiator receives this message and responds with a connection request message at time t1. According to the BLE link layer specification, the initiating device may change to connection state, taking the master role, once the connection request message has been transmitted, i.e., at time t1 in this example. Similarly, the device in advertising state may change to connection state, taking the slave role, once the connection request message has been received. In this example, neglecting processing time in the devices and the signal propagation time, the advertiser changes to connection state at time t1, i.e., at the same time as the initiator changes to connection state. The master then initiates the data transmission by sending a first data packet to the slave at time t2. This first transmission is referred to as the anchor point of the connection. The slave responds to this message at time t3. Following BLE terminology, the connection is said to be created once the connection request message has been transmitted and received by the master and slave, respectively. The connection is said to be established once a data packet from the peer has been correctly received. In this example, both devices hence consider the connection to be created at time t1. Device 1 considers the connection to be established at time t3 whereas device 2 considered the connection to be established at time t2.
In the example described above no packet errors occur, the peer devices are always in consistent states and the setup procedure runs smoothly. In practice, however, packet errors or other disturbances sometimes occur. For example, it may happen that the advertiser is not able to correctly decode the connection request message. This is illustrated in FIG. 4. FIG. 4 is a schematic diagram illustrating an example of an unsuccessful BLE connection setup.
The protocol does not include any explicit acknowledgement of the connection request message and such a decoding failure is hence unknown to the initiator, which may assume that the advertiser has received the connection request message and entered connection state at time t1. The advertiser, however, does not receive the connection request message and stays in advertising state. The result is a state mismatch. In relation to the example of FIG. 4, Device 2, in advertising state, will continue to act according to the protocol rules defined for the advertising state, which likely means it will make another try to transmit the advertisement message after some time. Device 1, on the other hand, is in connection state and hence transmits the data packet at time t4. This transmission is, however, destined to fail as the peer device, device 2, is not expecting any packet transmission and does not even try to receive this packet. In BLE, the state mismatch is solved by means of a timeout. In the example of FIG. 4, Device 1 will re-transmit the data packet several times, however, if no response from device 2 is received within some pre-defined time it will cause a time-out in existing methods. The time-out triggers a state change such that device 1 moves from connection state back to initiating state, via the standby state, and the state mismatch is resolved. In BLE, a connection that is created but not established may be considered lost after a time that corresponds to six connection intervals (connInterval). The length of the connection interval may be configurable and may take values in between 7.5 milliseconds (ms) and 4 seconds (s). The state mismatch is hence resolved after a time between 45 ms or 24 s.
A similar problem may appear when the connection should be terminated. A device that would like to terminate a connection may send a link layer termination message, which may be acknowledged by the peer. The device sending the acknowledgement of the termination message may go to standby state once the acknowledgement has been transmitted, while the device sending the termination message may go to standby state once the acknowledgement is received. If the acknowledgement is not received, however, there is one device in connection state and one device in standby state, i.e., there is a state mismatch. The device in connection state may continue to transmit or listen, depending on whether it is a master or slave, for packets on the data channel until the connection times out. In this case, for established connections, the timeout may take a value in between 100 ms and 32 s. It may be also specified that the timeout value may be at least (1+connSlaveLatency)*connInterval*2, where connSlaveLatency is the slave latency.
The existing state mismatch resolution scheme may solve the state mismatch; however, the resolution is slow and inefficient. If the mismatch occurs during the connection setup phase, the setup, and hence the data transfer, is significantly delayed. If it happens during connection termination, the device stays an unnecessarily long time in connection state. Another consequence of the state mismatch is further that packets that with full certainty are destined to fail are still transmitted, wasting both energy and causing unnecessary interference.
Moreover, some BLE devices may only support a single connection, and hence, if the master believes it is in connection with another device, it may not have the capability to serve any other device during the time of the state mismatch. The state mismatch hence degrades the performance not only of the link between the devices involved in the state mismatch but for the entire network.
The state mismatch problem is general and applies to all communication systems using state machines. If there is a state mismatch, the performance of the network may be degraded.